package com.unitd.base.module.logistics.enums;

import lombok.Getter;

/**
 * 物流状态枚举对象
 * @filename ExpressStateEnum.java
 * @copyright www.unitd.com
 * @author hudan
 * @version 1.0
 * @date 2019-02-01
 */
@Getter
public enum ExpressStateEnum {

	/** 物流状态(-1未查到快递信息、0在途中、1已揽收、2疑难、3已签收、4退签、5同城派送中、6退回、7转单) */
	NOT_EXIT("-1", "未查到快递信息"),
	ON_THE_WAY("0", "在途中"),
	HAS_CARGO("1", "已揽收"),
	DIFFICULT("2", "疑难"),
	SIGNED("3", "已签收"),
	SIGN_OUT("4", "退签"),
	LOCAL("5", "同城派送中"),
	SEND_BACK("6", "退回"),
	TRANSFER_ORDER("7", "转单");

	/** 物流状态代码 */
	private String code;
	/** 物流状态描述 */
	private String value;

	ExpressStateEnum(String code, String value) {
		this.code = code;
		this.value = value;
	}

	/**
	 * 根据code获取去value
	 * @param code 枚举代码
	 * @return 枚举响应的说明
	 */
	public static String getValueByCode(String code) {
		for (ExpressStateEnum stateEnum : ExpressStateEnum.values()) {
			if (code.equals(stateEnum.getCode())) {
				return stateEnum.getValue();
			}
		}
		return null;
	}
}
